#include<iostream>
using namespace std;
const int N = 1e2 + 10;
long long arr[N];	
int main()
{
	int n;
	cin >> n;
	int count = 1;
	arr[0] = n;
	while (n != 1) {
		if (n % 2 == 0) {
			n /= 2;
		}
		else {
			n = n * 3 + 1;
		}
		arr[count++] = n;
	}
	for (int i = count - 1; i >= 0; i--) {
		cout << arr[i] << " ";
	}
	return 0;
}